# Plot frequency response
import control  # pip install control
import matplotlib.pyplot as plt
import math
import numpy as np
sysTfList = []
sysTfList.append(control.tf([1], [1, 0.4, 0]))
mag, phase, omega = control.bode(sysTfList, omega=np.logspace(
    start=-2, stop=1, num=200), dB=False, deg=True, plot=False)
plt.plot(omega, mag)
phase1 = 180/math.pi*phase  # to degree
plt.plot(omega, phase1)
w1 = [0.1*math.pi, 0.4*math.pi, 0.8*math.pi, 2*math.pi]
A = [6.26, 0.60, 0.16, 0.04]
A = 20*np.log10(A)
Phai = [-130.48, -161.50, -169.34, -183.60]
plt.plot(w1, A, 'o')
plt.plot(w1, Phai, 'o')
plt.show()
